package video

import (
	"github.com/labstack/echo"
	resp "tacitus/library/response"
	"time"
)

func ShowCateContentListHandler(c echo.Context) error {
	i := new(struct{
		CateID int64 `json:"cate_id"`
	})
	if err := c.Bind(i); err != nil {
		return err
	}
	data, err := SelectContentByCate(i.CateID)
	if err != nil {
		return err
	}
	return resp.Data(c, data)
}

func CreateAssociationHandler(c echo.Context) error {
	i := new(Association)
	if err := c.Bind(i); err != nil {
		return err
	}
	i.ID = 0
	i.CreateTime = time.Now().Unix()
	if _, err := rx.Insert(i); err != nil {
		return err
	}
	return nil
}
